﻿@using Carer.Data
@using Carer.Crm.ViewModel
@using Carer.App
@using Carer.Data.Enum
@{
    ViewBag.Title = "人员管理";
    Layout = "~/Views/Shared/_LayoutNew.cshtml";

    var crewTypes = ViewBag.CrewTypes as IList<CrewType>;
    if (crewTypes == null)
    {
        crewTypes = new List<CrewType>();
    }

    var categories = ViewBag.Categories as IList<Category>;
    if (categories == null)
    {
        categories = new List<Category>();
    }

    var payments = ViewBag.Payments as IList<Payment>;
    if (payments == null)
    {
        payments = new List<Payment>();
    }
}
@model IndexModel
<div class="container">
    <div id="toolbar">
        <div class="form-inline" role="form">
            <div class="form-group">
                <span>姓名: </span>
                <input name="Name" type="text" class="form-control" />
            </div>
            <div class="form-group">
                <span>性质: </span>
                <select name="Type" class="form-control">
                    <option value="">所有</option>
                    @foreach (var item in crewTypes)
                    {
                        <option value="@item.Name">@item.Name</option>
                    }
                </select>
            </div>
            <div class="form-group">
                <span>状态: </span>
                <select name="Status" class="form-control">
                    <option value="">所有</option>
                    <option selected="selected">在职</option>
                    <option>离职</option>
                </select>
            </div>
            <div class="form-group">
                <span>技能: </span>
                <select name="Skill" class="form-control">
                    <option value="">所有</option>
                    @foreach (var item in categories)
                    {
                        <option value="@item.Name">@item.Name</option>
                    }
                </select>
            </div>
            <div class="form-group">
                <button class="query btn btn-primary"><i class="fa fa-search fa-lg"></i> 查 询</button>
                <button class="add btn btn-default"><span class="add"></span>增 加</button>
                <button class="delete btn btn-default"><span class="delete"></span> 删 除</button>
            </div>
        </div>
    </div>
    <table id="crewTable"></table>
</div>

<div id="edit" class="view edit">
    <div class="title"><span>人员信息</span></div>
    <form action="EditCrew" method="post" enctype="multipart/form-data">
        <input class="Id" name="Id" type="hidden" />
        <table>
            <tr>
                <td class="title"><font color="red">*</font> 姓 名：</td>
                <td class="content"><input type="text" name="Name" class="Name form-control" /></td>
                <td class="title"><font color="red">*</font> 身份证号：</td>
                <td class="content"><input name="IdNo" type="text" class="IdNo form-control" /></td>
                <td class="preview" colspan="2" rowspan="10">
                    <div>
                        <img alt="" src="" />
                    </div>
                </td>
            </tr>
            <tr>

                <td class="title"><font color="red">*</font> 性 别：</td>
                <td class="content">
                    <select name="Gender" class="Gender form-control">
                        <option>女</option>
                        <option>男</option>
                    </select>
                </td>
                <td class="title">签发机关：</td>
                <td class="content"><input name="IdIssuer" type="text" class="IdIssuer form-control" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 性 质：</td>
                <td class="content">
                    <select name="Type" class="Type form-control">
                        @foreach (var item in crewTypes)
                        {
                            <option value="@item.Name">@item.Name</option>
                        }
                    </select>
                </td>
                <td class="title">暂住证号：</td>
                <td class="content"><input name="TrcNo" type="text" class="TrcNo form-control" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 状 态：</td>
                <td class="content">
                    <select name="Status" class="Status form-control">
                        <option>在职</option>
                        <option>离职</option>
                    </select>
                </td>
                <td class="title">签发机关：</td>
                <td class="content"><input name="TrcIssuer" type="text" class="TrcIssuer form-control" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 技 能：</td>
                <td class="content">
                    <select name="Skill" class="Skill form-control">
                        @foreach (var item in categories)
                        {
                            <option value="@item.Name">@item.Name</option>
                        }
                    </select>
                </td>

                <td class="title">发证日期：</td>
                <td class="content"><input name="TrcStart" type="text" class="TrcStart date form-control" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 等 级：</td>
                <td class="content">
                    <select name="Level" class="form-control">
                        <option>一级</option>
                        <option>二级</option>
                        <option>三级</option>
                    </select>
                </td>

                <td class="title">健康证号：</td>
                <td class="content"><input name="HealthNo" type="text" class="HealthNo form-control" /></td>
            </tr>
            <tr>
                <td class="title">所属单位：</td>
                <td class="content">
                    <select name="OwnerUnitId" class="OwnerUnitId form-control">
                        @if (Model.Role == EnumRole.Platform_Manager)
                        {
                            foreach (var item in Model.AllUnits)
                            {
                                <option value="@item.Id">@item.Name</option>
                            }
                        }
                        else if (Model.UserUnit != null)
                        {
                            <option value="@Model.UserUnit.Id">@Model.UserUnit.Name</option>
                        }
                        else
                        {
                            @*<option value="">平台</option>*@
                        }
                    </select>
                </td>
                <td class="title">签发机关：</td>
                <td class="content"><input name="HealthIssuer" type="text" class="HealthIssuer form-control" /></td>
            </tr>
            <tr>
                <td class="title">服务单位：</td>
                <td class="content">
                    <select name="ServiceUnitId" class="ServiceUnitId form-control">
                        @if (Model.Role == EnumRole.Platform_Manager)
                        {
                            foreach (var item in Model.AllUnits)
                            {
                                <option value="@item.Id">@item.Name</option>
                            }
                        }
                        else if (Model.UserUnit != null)
                        {
                            <option value="@Model.UserUnit.Id">@Model.UserUnit.Name</option>
                        }
                        else
                        {
                            @*<option value="">平台</option>*@
                        }
                    </select>
                </td>

                <td class="title">发证日期：</td>
                <td class="content"><input name="HealthStart" type="text" class="HealthStart date form-control" /></td>
            </tr>
            <tr>
                <td class="title">出生日期：</td>
                <td class="content"><input name="Birthday" type="text" class="Birthday date form-control" /></td>

                <td class="title">上岗证号：</td>
                <td class="content"><input name="LicenseNo" type="text" class="LicenseNo form-control" /></td>
            </tr>
            <tr>
                <td class="title">籍 贯：</td>
                <td class="content"><input name="Native" type="text" class="Native form-control" /></td>
                <td class="title">上岗类别：</td>
                <td class="content">
                    <select name="LicenseType" class="LicenseType form-control">
                        <option>护工上岗证</option>
                        <option>母婴护理证</option>
                        <option>养老护理证</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="title">联系电话：</td>
                <td class="content"><input name="Tel" type="text" class="Tel form-control" /></td>
                <td class="title">签发机关：</td>
                <td class="content"><input name="LicenseIssuer" type="text" class="LicenseIssuer form-control" /></td>
                <td class="title">照 片：</td>
                <td class="content"><input name="file" type="file" class="file form-control" /></td>
            </tr>
            <tr>
                <td class="title">上岗日期：</td>
                <td class="content"><input name="WorkStart" type="text" class="WorkStart date form-control" /></td>
                <td class="title">发证日期：</td>
                <td class="content"><input name="LicenseStart" type="text" class="LicenseStart date form-control" /></td>
                <td class="title">培 训：</td>
                <td class="content"><input name="Training" type="text" class="Training form-control" /></td>
            </tr>
            <tr>
                <td class="title">离岗日期：</td>
                <td class="content"><input name="WorkEnd" type="text" class="WorkEnd date form-control" /></td>
                <td class="title">家庭住址：</td>
                <td class="content"><input name="Addr" type="text" class="Addr form-control" /></td>
                <td class="title">备 注：</td>
                <td class="content"><input name="Note" type="text" class="Note form-control" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 结算标准：</td>
                <td class="content">
                    <select name="PaymentId" class="PaymentId form-control">
                        @foreach (var item in payments)
                        {
                            <option value="@item.Id">@item.Name</option>
                        }
                    </select>
                </td>
            </tr>
        </table>
        <p class="submit">
            <button class="save btn btn-success"><i class="fa fa-save fa-lg"></i> 保 存</button>
            <button class="cancel btn btn-danger"><i class="fa fa-close fa-lg"></i> 取 消</button>
        </p>
    </form>

</div>

<div id="schedule" class="view">
    <div class="query">
        <ul class="tool">
            <li><button class="delete btn btn-default"><span class="delete"></span> 删 除</button></li>
            <li><button class="cancel btn btn-danger"><i class="fa fa-reply fa-lg"></i> 返 回</button></li>

        </ul>
        <form action="">
            <input class="CrewId" name="CrewId" type="hidden" />
            <ul>
                <li><label>客户姓名</label><input name="CustomerName" type="text" class="form-control" /></li>
                <li><label>开始</label><input name="Start" type="text" value="2016-11-19" class="date form-control" /></li>
                <li><label>结束</label><input name="End" type="text" value="2016-11-19" class="date form-control" /></li>

                <li><button class="query btn btn-primary"><i class="fa fa-search fa-lg"></i> 查 询</button></li>
            </ul>
        </form>
    </div>

    <div class="list">
        <table class="list">
            <thead>
                <tr>
                    <th><input class="selall" type="checkbox" /></th>
                    <th>客户姓名</th>
                    <th>服务项目</th>
                    <th>服务时间</th>
                    <th>班次</th>
                    <th>分成比例</th>
                    <th>调整金额</th>
                    <th>结算金额</th>
                    <th>客户评价</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <div id="spager" class="jpager"></div>
</div>

<div id="add" class="view edit">
    <div class="title"><span>排班信息</span></div>
    <form action="">
        <input class="CrewId" name="CrewId" type="hidden" />
        <table>
            <tr>
                <td class="title">服务人员：</td>
                <td class="content"><input class="CrewName form-control" name="CrewName" type="text" readonly="readonly" /></td>
                <td class="title">联系电话：</td>
                <td class="content"><input class="CustomerName form-control" name="CustomerName" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 服务时间：</td>
                <td class="content"><input class="Start date form-control" name="Start" type="text" /></td>
                <td class="title"><font color="red">*</font> 班次：</td>
                <td class="content">
                    <select class="Shift pay form-control" name="Shift">
                        <option value="0">全天</option>
                        <option value="1">白班</option>
                        <option value="2">夜班</option>
                    </select>
                </td>
            </tr>
        </table>


        <table class="list">
            <thead>
                <tr>
                    <th>客户姓名</th>
                    <th>服务项目</th>
                    <th>地址</th>
                    <th>开始时间</th>
                    <th>结束时间</th>
                    <th>订单状态</th>
                </tr>
            </thead>
        </table>
    </form>
    <p class="submit">
        <button class="save btn btn-success"><i class="fa fa-save fa-lg"></i> 保 存</button>
        <button class="cancel btn btn-danger"><i class="fa fa-close fa-lg"></i> 取 消</button>
    </p>
</div>

@section Scripts {
    @Scripts.Render("~/Content/Common/util.js?v=" + MvcApplication.TimeStamp)
    @Scripts.Render("~/Content/Business/crew.js?v=" + MvcApplication.TimeStamp)
}
